<%--
 *  File:   OutPeriodDataSummary.jsp
 *  Desc:	Report Director depend on OvalReport4.0
 *
 *  Date		         Author		      Changes
 *  2010-07-29	         Jamesli		  Created
 *  
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<%//init param
			String privilegeCode = "E0215";
			String strTableName = "v_salesdatafilesummary";
			String strModuleName = "CM";
			String contextPath = request.getContextPath();

			%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>


<html>
<head>
<title>OutPeriodDataSummary</title>
<PageFlow:CheckPageFlow pageName="p_outperioddatasummary" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%Vector totalsummary = (Vector) pageContext.getAttribute("totalsummary");
			if (totalsummary == null)
				totalsummary = new Vector();

			HashMap UserInfo = (HashMap) session.getAttribute("userinfo");
			if (UserInfo == null)
				UserInfo = new HashMap();
Vector errorcode = (Vector)session.getAttribute("errorcode");
System.out.println(errorcode);
if(errorcode == null) errorcode = new Vector();
%>
<%@ include file="/inc/AlertError.inc" %>


<script language="JavaScript">

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  
  	editform.action = "OutPeriodDataSummary.jsp?<%= OvalTools.randomURL() %>";
    editform.target = "_self";
    isRunning = true;
    editform.submit();
}


function file_edit(){
    var salesdatafileids = document.cform.fileid;    
    var salesdatafileid = -1;
    if(salesdatafileids.length == null){
    	salesdatafileid = salesdatafileids.value;
    }else{
	    for(var i = 0 ; i < salesdatafileids.length;i++){
	    	if(salesdatafileids[i].checked) {
	        	salesdatafileid = salesdatafileids[i].value;
	        	break;
	        }
		}
    }
    var processtype = cform.processtype.value;
    var datafrequency = document.cform.datafrequency.value;
	self.location.href = "OutPeriodDataDetail.jsp?<%= OvalTools.randomURL() %>&processtype=" + processtype + "&fileid="+salesdatafileid+"&datafrequency="+datafrequency;
}

function page_onload(){
	<%if(errorcode.size() != 0){%>
		self.location.href="<%=contextPath %>/Blank.jsp";
	<%}%>
}
</script>
</head>
<body style="overflow: auto;" onload="page_onload()">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_outperioddatasummary">
	<input type="hidden" name="actionname">
	<input type="hidden" name="type">
	<input type="hidden" name="name">
	<custom:hidden property="processtype"/>
	<custom:hidden property="datafrequency"/>
	<custom:hidden property="languagecode" scope="session" name="userinfo"/>

	
	<%--  page location   --%>
<%@ include file="/inc/PageLocation.inc"%>

<table width="100%" cellspacing="0" cellpadding="0" border="0">
      <tr>
        <td>
          <table width="100%" border="0" cellspacing="0">
            <%@ include file="/inc/SummarySearch.inc" %>
          </table>
        </td>
      </tr>
</table>


<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
	
	<%----------------------------------????----------------------------%>
		<tr class="deepblue-left">
				<td class="title_center" width="3%">&nbsp;</td>
				<td class="title_center" width="5%"><%= label.getLabelName("L_Serial") %></td>
                <td class="title_center" width="20%"><%= label.getLabelName("L_CreateTime") %></td>
                <td class="title_center" width="62%"><%= label.getLabelName("L_filename") %></td>
		        <td class="title_center" width="10%"><%= label.getLabelName("L_Status") %></td>		
		</tr>
	
	
			<%int i = 0;
			String strClassType = "";
			String strIsChecked = "Checked";
			int summarysize = totalsummary.size();
			%>
			<logic:iterate id="summary" collection="<%=totalsummary %>" indexId="idx">
				<%if (i % 2 == 1) {
					strClassType = "td-listrom";
				} else {
					strClassType = "none";
				}
				
				if(i != 0)         
		          	strIsChecked = "";
		       
				i++;
			%>
		<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=strClassType%>'" class="<%=strClassType%>" onClick="javascript:radiotrue('<%if(i == 1 && summarysize == 1){%>fileid<%}else{%>fileid[<%=JspHelper.filterNull(i-1)%>]<%} %>');">
			<td>
			    <%
			    	HashMap arow = (HashMap)pageContext.getAttribute("summary");
	            	String salesdatafileid = ((Integer)arow.get("fileid")).toString();
				%>
				<input type="radio" name="fileid" value="<%=salesdatafileid%>" <%= strIsChecked %> class="normalradio">
			</td>
			<td>
				<%=i %>
			</td>
			<td>
				<custom:write property="createdate" dataType="Date" dataFormat="yyyy-MM-dd HH:mm:ss" name="summary" nbsp="true"/>
			</td>
			<td>
				<custom:write property="filename" name="summary" nbsp="true"/>
			</td>
			<td>
				<%= label.getLabelName("L_OutPeriodData") %>
			</td>
		</tr>
			</logic:iterate>
			<%@ include file="/inc/SummaryAction.inc"%>
	</table>
	<table width="100%" cellspacing="0" cellpadding="0">
             <tr>
                  <td class="summary_top"></td>
            </tr>
	        <tr>
				<td class="td_center">
				<%if(i != 0){ %>
					<a onclick="file_edit();"><custom:button type="1" label="L_Edit" imgsrc="add.gif" border="0" style="width:60" /></a>
				<%}else{ %>
					&nbsp;
				<%} %> 
				</td>	
			</tr>
	</table>
</form>
</body>
</html>